#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__

#include"my_head.h"
#include"taskqueue.h"
#include"tidarr.h"

typedef struct threadpool_s{
    tidarr_t thread_arr;  //子线程数组
    taskqueue_t queue;   //共享队列
    pthread_mutex_t mutex;
    pthread_cond_t cond;
    int exitFlag; //退出标志位
    int logfd; //日志文件描述符
  
}threadpool_t;

//初始化线程池
int init_thread_pool(threadpool_t* pool,int worknum);

//创建tcp连接
int creat_tcp(const char* ip,const char* port);

//添加epoll事件
int epoll_add_event(int epfd,int fd);
int epoll_del_event(int epfd,int fd);

//工作
void *worker_function(void *arg);
int creat_worker(threadpool_t * threadpool);

#endif